package org.dromara.common.core.domain.model

import jakarta.validation.constraints.Email
import jakarta.validation.constraints.NotBlank

/**
 *@author LikeYouDo
 *@date 2025/1/3 16:37
 */
data class EmailLoginBody(
    /**
     * 邮箱
     */
    @NotBlank(message = "{user.email.not.blank}")
    @Email(message = "{user.email.not.valid}")
    var email: String = "",

    /**
     * 邮箱code
     */
    @NotBlank(message = "{email.code.not.blank}")
    var emailCode: String = "",
) : LoginBody() {
    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (other !is EmailLoginBody) return false
        if (!super.equals(other)) return false

        if (email != other.email) return false
        if (emailCode != other.emailCode) return false

        return true
    }

    override fun hashCode(): Int {
        var result = super.hashCode()
        result = 31 * result + email.hashCode()
        result = 31 * result + emailCode.hashCode()
        return result
    }
}
